package collection.day04;

import java.util.*;

/**
 * @Author: Miyako
 * @Date: 2024-07-15-10:54
 * @Description:sort方法的重载
 */
public class CollectionSortDemo03 {
    public static void main(String[] args) {
        Random rand = new Random();
        point p1 = new point(10,20);
        point p2 = new point(50,10);
        point p3 = new point(30,1);
        List<point> pointList= new ArrayList<point>();
        List<String> stringList = new ArrayList<>();
        List<Integer> intList = new ArrayList<>();

        while(intList.size()<10){
            Integer r= rand.nextInt(101);
            intList.add(r);
        }

        Collections.sort(intList,(o1,o2)->o2-o1);
        System.out.println(intList);

//        stringList.add("牛");
//        stringList.add("王ss");
//        stringList.add("张sss");
//        Collections.sort(stringList);
//        System.out.println(stringList);

//        pointList.add(p1);
//        pointList.add(p2);
//        pointList.add(p3);
//
////        Comparator<point> comparator1 = new Comparator<point>() {//创建一个匿名内部类比较x的值
////            @Override
////            public int compare(point o1, point o2) {
////                return o1.getX()-o2.getX();
////            }
////        };
////        Comparator<point>comparator2 = new Comparator<point>() {//创建一个匿名内部类比较y的值
////            @Override
////            public int compare(point o1, point o2) {
////                return o1.getY()-o2.getY();
////            }
////        };
////        pointList.sort(comparator1);
////        System.out.println(pointList);
////        Collections.sort(pointList,comparator2);
////        System.out.println(pointList);
//        Collections.sort(pointList,(o1,o2)-> o2.getX()- o1.getX());
//        System.out.println(pointList);
    }

}
